﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.ParkManage;
using LJX.SmartPark.Service.ParkManage;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.ParkManage.ContractManageServeice;

namespace LJX.SmartPark.WebApi.Controllers.ParkManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "ParkManage")]
    public class ContractManageController : ControllerBase
    {
        private readonly IContractManageServeice _contractManageService;

        public ContractManageController(IContractManageServeice contractManageService)
        {
            _contractManageService = contractManageService;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateContractManage(ContractManage input)
        {
            var result = _contractManageService.PutUpdContractManageAsync(input);
            return result;
        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _contractManageService.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<ContractManage>> GetEquipmentLedgerAsync(FyContractManage fyContractManage)
        {
            var result = _contractManageService.GetContractManageAsync(fyContractManage);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<ContractManage> GetEquipmentLedgerById(ContractManage input)
        {
            var result = _contractManageService.GetContractManageById(input);
            return result;
        }
    }
}
